<div class="heading">
    <div style="float:left;">
        <div style="float:left;">
            
            <form  action="<?=base_url()?>admin/managenews/search" method="post" name="frm_search">
                    <input type="text" name="txt_search" id="txt_search">
                    <input type="submit" name="search" value="Tìm kiếm">
            </form>
   </div>
        <div style="float:left;">
        <form  action="<?=base_url()?>admin/managenews/catalogue" method="post" name="frm_order">
        &nbsp;&nbsp;&nbsp;Danh mục : 
        <input type="hidden" name="search_catalogue" id="search_catalogue" value="Danh mục">
        <select id="catalogue" name='catalogue' onchange="submit(this.form);">
            <option value="-1" <?php if(@$option == -1)echo 'selected';?>>Tất cả</option>
            <option value="0" <?php if(@$option == 0)echo 'selected';?>>Tin sự kiện</option>
                    <?php
                        if(@$catalogue)
                        {
                            foreach($catalogue as $cat)
                            {
                                ?>
                                <option value="<?=$cat->id;?>" <?php if(@$option == $cat->id) echo 'selected';?> ><?=repeater('&raquo;&raquo; ', $cat->depth) . $cat->name;?></option>
                                <?php
                            }
                        }
                    ?>
            	</select>
        
        
        &nbsp;&nbsp;&nbsp;Sắp xếp : 
            <select d="order" name='order' onchange="submit(this.form);">
                <option value="0" <?php if(@$order==0)echo 'selected';?>>ID giảm dần</option>
                <option value="1" <?php if(@$order==1)echo 'selected';?>>ID tăng dần</option>                
                
            </select>
            </form>
            </div>
    </div>
  <div class="buttons"><a class="button" onclick="location='<?php echo base_url();?>admin/managenews/add'"><span class="button_left button_insert"></span>
  <span class="button_middle">Thêm</span><span class="button_right"></span></a><a class="button" onclick="$('form').submit();"><span class="button_left button_delete"></span><span class="button_middle">Xoá</span><span class="button_right"></span></a></div>
</div>
<form action="<?=base_url();?>admin/managenews/delete_news" method="post" enctype="multipart/form-data" id="form">
  <table class="list">
    <thead style="height: 34px;font-weight: bold;">
      <tr>
        <td width="1" align="center"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);"></td>
        <td class="left">ID</td>
        <td class="left">Tiêu đề</td>
        <td class="left">Ảnh</td>
        <td class="left">Danh mục</td>
        <td class="left">Ngày tạo</td>
        <td class="right">Action</td>
      </tr>
    </thead>
    <tbody>
      <?php 
      if (@$news) {
        $class = 'odd';
        foreach ($news as $n) { 
        $class = ($class == 'even' ? 'odd' : 'even'); 
      ?>
        
          <tr class="<?php echo $class; ?>">
            <td align="center">
                <input type="checkbox" value="<?=$n->id;?>" name="selected[]">
            </td>
            <td class="left" align="center"><?=$n->id?></td>
            <td class="left" align="center"><b><?=$n->title?></b></td>
            <td class="left" align="center"><img src="<?=base_url()?>uploads/news/<?=$n->image?>" width="64" height="64"></td>
            <td class="left" align="center"><?=$n->catalogue?></td>
             <td class="left" align="center"><?=date('d-m-Y',$n->time);?></td>
            <td class="right" align="center">
              [ <a href="<?=site_url('admin/managenews/update/'.$n->id)?>">Sửa</a> ] [ <a href="<?=site_url('admin/managenews/delete/'.$n->id)?>" onclick="return confirm('Bạn có chắc muốn xóa?');">xóa</a> ]
            </td>
          </tr>
      <?php 
        }
      }
      ?>
    </tbody>
  </table>
  <p class="pagination" align="center"><?php echo @$paginator;?></p>
</form>